<!DOCTYPE html>
<html>

<head>
  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="../bootstrap-5.1.3-dist/css/bootstrap.css" rel="stylesheet">
  <script src="../bootstrap-5.1.3-dist/js/bootstrap.bundle.js"></script>
</head>

<body class="container">
  <div><br>
    <button type="button" class="btn btn-primary" id="liveToastBtn">吐司消息</button>
    <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 5">
      <div id="liveToast" class="toast hide" data-bs-animation="false" role="alert" aria-live="assertive"
        aria-atomic="true">
        <div class="toast-header">
          <strong class="me-auto">吐司消息提示</strong>
          <small>5秒之前</small>
          <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
        </div>
        <div class="toast-body">
          您有一条新短消息！
        </div>
      </div>
    </div>
  </div>
  <script>
    document.querySelector("#liveToastBtn").onclick = function () {
      new bootstrap.Toast(document.querySelector('.toast')).show();
    }
  </script>


</body>

</html>